package network.protocol;

/**
 * 
 * @author Erik
 * The whole protocol.
 */

/**
 * === NEW PROTOCOL =====
 * Header
 * ------------------
 * Length (2xBYTE)       //length of the package without the header-length
 * PackageID  (BYTE)     // id of the package
 * Data	(String)		 //data
 * ------------------
 */



/**
 * S = Server, C = A client
 * S(broadcast) = broadcast to all clients
 * C(name) = a specific client(often the one that is affected)
 * C(sender) = the client who sent the data
 * 
 * 
 * ==================== Data ================================== PackageID ========
 * LOGIN:
 * C -> S				(String - name) 						(LOGIN)
 * S(broadcast) -> C	(PlayerPackage)							(PLAYER_CHANGED_NAME)
 * 
 * 
 * 
 * KICK_PLAYER:
 * C -> S				(String - the player(name) to kick)		(KICK)
 * 
 * S -> C(String)
 * S(broadcast) -> C	(player was kicked)						(LOBBY_MESSAGE)
 * 
 * OR (depends if the player-name was found or not)
 * s -> C(sender)		(String - "player not found")			(LOBBY_MESSAGE)
 * 
 * 
 * 
 * LOBBY_MESSAGE:
 * C -> S				(String - the message)					(LOBBY_MESSAGE) 
 * S(broadcast) -> C	(String - the message)					(LOBBY_MESSAGE) 
 * 
 * 
 * 
 * UPDATE_PLAYERS:
 * C -> S				(String - "list")						(UPDATE_PLAYERS)
 * S -> C				(PlayerPackage)							(UPDATE_PLAYERS)
 * 
 * 
 * 
 * INIT_GAME:
 * C ->	S	(String - the map(name))							(INIT_GAME)
 * S(broadcast) -> C	(PlayerPackage)							(UPDATE_PLAYERS)
 * S(broadcast) -> C	(String - the map(name))				(INIT_GAME)
 * 
 * 
 * 
 * BUILDING_CONVERT:
 * C -> S				(ConvertPackage)						(BUILDING_CONVERT)
 * S(broadcast) -> C	(ConvertPackage)						(BUILDING_CONVERT)
 * 
 * 
 * 
 * ATTACK:
 * C -> Server			(AttackPackage)							(ATTACK)
 * S(broadcast) -> C	(ATtackPackage)							(ATTACK)
 * 
 * 
 * 
 * SYNC_PLAYERS:
 * S(broadcast) -> C	(PlayersPackage)						(SYNC_PLAYERS)
 * 
 * 
 * 
 * PLAYER_DISCONNECTED:
 * S(broadcast) -> C	(PlayerPackage)							(PLAYER_DISCONNECTED)
 * 
 * 
 * 
 * PLAYER_CONNECTED:
 * S(broadcast) -> C	(PlayerPackage)							(PLAYER_CONNECTED)
 * 
 * 
 * 
 * BUILDING_IS_EMPTY:
 * S(broadcast) -> C	(Integer - BuildingID)					(BUILDING_IS_EMPTY)
 * 
 * 
 * 
 * BUILDING_OWNER_CHANGED:
 * S(broadcast) -> C	(BuildingOwnerChangedPackage)			(BUILDING_OWNER_CHANGED)
 * 
 * 
 * 
 * SYNC_BUILDINGS_POP:
 * S(broadcast) -> C	(syncBuildingsPopPackage)				(SYNC_BUILDINGS_POP)
 * 
 * 
 * 
 * WIN_CONDITION:
 * S(broadcast) -> C	(Integer - PlayerID)					(WIN_CONDITION)
 * 
 * 
 * 
 * SYNC_MOVE:
 * S(broadcast) -> C	(Integer - syncTicket)					(SYNC_MOVE)
 */


public class Protocol {
	public static final short OK = 0;
	public static final short BAD_PACKAGE = 1;
	public static final short LOGIN = 2;
	public static final short ENTER_LOBBY = 3;
	public static final short LOBBY_MESSAGE = 4;
	public static final short KICK_PLAYER = 5;
	public static final short PLAYER_DISCONNECTED = 6;
	//public static final short LOBBY = 7;
	public static final short UPDATE_PLAYERS = 8;
	public static final short PLAYER_CONNECTED = 9;
	public static final short PLAYER_CHANGED_NAME = 10;
	public static final short ATTACK = 11;	
	public static final short INIT_GAME = 12;
	public static final short BUILDING_IS_EMPTY = 13;
	public static final short BUILDING_OWNER_CHANGED = 14;
	public static final short BUILDING_CONVERT = 15;
	public static final short SYNC_BUILDINGS_POP = 16;
	public static final short SYNC_PLAYERS = 17;
	public static final short SYNC_MOVE = 18;
	public static final short WIN_CONDITION = 19;
}
